public class Java318 {
    public static void main5(String[] args) {
        int [] array = new int[]{5,15,26,35};
        double ave = averrage(array);
        System.out.println(ave);
    }

    public static double averrage(int []a){
        int i = 0;
        double sum = 0.0;
        for (; i < a.length; i++) {
            sum += a[i];
        }
        return sum/i;
    }


    public static void main4(String[] args) {
        int [] array = new int[]{5,15,25,35};
        int total = sum(array);
        System.out.println(total);
    }

    public static  int sum(int []a){
        int sum = 0;

        for (int i = 0; i < a.length; i++) {
            sum += a[i];
        }
        return sum;
    }




    public static void main3(String[] args) {
        int [] array = new int[]{2,4,6,8,7,10,50};
        System.out.println("修改之前");
        printArray(array);
        System.out.println("==============");
        System.out.println("修改之后");
        transform(array);
        printArray(array);
    }
    public static void transform(int [] a){
        for (int i = 0; i < a.length; i++) {
            a[i] = a[i] * 2;
        }
    }
    public static void printArray(int [] a){
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]+" ");

        }
        System.out.println("\n");
    }



    public static void main2(String[] args) {
        int [] array = new int[20];
        for (int i = 0; i < array.length; i++) {
            array[i] = i + 1;
        }
        printArray(array);

    }



    public static void main1(String[] args) {

        int [] array = new int[100];
        for (int i = 0; i < array.length; i++) {
            array[i] = i + 1;
        }
        for (int i = 0; i < array.length; i++) {
            System.out.println(array[i]);
        }
    }
}
